from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
from django.conf import settings
from django.contrib.auth.views import login, logout, password_change, logout_then_login
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    url(r'^$', 'tussin.views.home', name='home'),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
    url(r'^news/latest/$', 'tussin.news.views.latest'),
    url(r'^channel/(?P<channel_id>\d+)/$', 'tussin.news.views.article_list'),
    url(r'^news/view/(?P<article_id>\d+).html$', 'tussin.news.views.article_detail'),
    url(r'^search/$', 'tussin.news.views.search'),
    url(r'^accounts/$', 'tussin.accounts.views.profile'),
    url(r'^accounts/login/$', 'tussin.accounts.views.login'),
    url(r'^accounts/logout/$', logout_then_login),
    url(r'^accounts/register/$', 'tussin.accounts.views.register'),
    url(r'^accounts/changepassword/$', 'tussin.accounts.views.change_pass'),
    url(r'^sina_verified_check.txt$','tussin.views.weibo_verification'),
    #url(r'^grappelli/', include('grappelli.urls')),
)

if settings.DEBUG:
    urlpatterns += patterns('',
        url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
        url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
    )
#urlpatterns += staticfiles_urlpatterns()
